<template>
    <div>
        <h1>新增房号信息</h1>
    </div>

     <table class="table">
         <thead>    
             <tr>
                <td>房号名称</td>
                 <td>
                    <input type="text" v-model="data.starePteaName">
                 </td>
             </tr>

               <tr>
                <td>备注</td>
                 <td>
                    <textarea v-model="data.starePteaName"></textarea>
               
                 </td>
             </tr>

               <tr>
                <td>结束时间</td>
                 <td>
                      <input type="date" v-model="data.endStarePtea">
                 </td>
             </tr>

               <tr>
                <td></td>
                 <td>
                    <input type="button" value="新增" @click="addd">
                 </td>
             </tr>

         </thead>
     </table>
        
</template>


<script setup lang="ts">
  import axios from 'axios';
  import{ref,onMounted} from 'vue';
 import {useRouter} from 'vue-router';

  const router=useRouter();

   const data=ref({
 "starePteaId": 0,
  "stareId": 0,
  "starePteaName": "",
  "starePteaType": "",
  "starePteaDate": "2025-06-16T10:28:09.551Z",
  "endStarePtea": "2025-06-16T10:28:09.551Z",
  "idelete": 0,
  "isStarePtea": true

   })



    const addd=()=>{
          axios.post("https://localhost:7295/api/StarePtea/AddAnyns",data.value).then(res=>{
               if(res.data==-1){
               alert("房间号已存在");
                 return;
               }else if(res.data>0){
alert("新增成功") ;
  router.push("/showstate");
               }else{
                alert("新增失败");
               }
          }) 
    }



</script>

<style scoped>

</style>
